import {User} from "../../@core/data/user";

export interface UserEvent {
  type: ActionTypes
  users?: User[]
}

export interface UserUpdateEvent extends UserEvent {
  type: ActionTypes.UPDATE_USER,
  user: User,
}

export interface UserAddEvent extends UserEvent {
  type: ActionTypes.ADD_USER,
  user: User,
}

export interface UserRemoveEvent extends UserEvent {
  type: ActionTypes.REMOVE_USER,
  uid: string,
}

export enum ActionTypes {
  ADD_USER = 'ADD_USER',
  REMOVE_USER = 'REMOVE_USER',
  UPDATE_USER = 'UPDATE_USER',
  CONCAT = 'concat',
  // 每次 init 都是重新请求
  INIT = 'INIT',
}
